<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<%@ page isELIgnored="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-cn">
<head>
<title>用户注册</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="gb2312" />
<link href="skin1/css/public.css" type="text/css" rel="stylesheet" />
<link href="skin1/css/invite.css" type="text/css" rel="stylesheet" />
<link href="skin1/css/header.css" type="text/css" rel="stylesheet" />
<script type='text/javascript' src='dwr/interface/ProvinceService.js'></script>
		<script type='text/javascript' src='dwr/interface/CityService.js'></script>
		<script type='text/javascript' src='dwr/interface/RegionService.js'></script>
	    <script type='text/javascript' src='dwr/util.js'></script>
	    <script type='text/javascript' src='dwr/engine.js'></script>
		<script type="text/javascript">
			function findPro(){
			
			ProvinceService.findAll(backPro);
			 
			}
			function backPro(data){
			DWRUtil.removeAllOptions("province");
			DWRUtil.addOptions("province",{'':'请选择'});
			DWRUtil.addOptions("province", data, "code", "name");
			}
			function findCity(){
			var proValue=document.all.province.value;
			CityService.findByProvince(proValue,backCity); 
			}
			function backCity(data){
			DWRUtil.removeAllOptions("city");
			DWRUtil.addOptions("city",{'':'请选择'});
			DWRUtil.removeAllOptions("region");
			DWRUtil.addOptions("region",{'':'请选择'});
			DWRUtil.addOptions("city", data, "code", "name");
			
			}
			function findRegion(){
			var cityVlaue=document.all.city.value;
			RegionService.findByCity(cityVlaue,backRegion);
			}
			function backRegion(data){
			DWRUtil.removeAllOptions("region");
			DWRUtil.addOptions("region",{'':'请选择'});
			DWRUtil.addOptions("region", data, "code", "name");
			}
			

			

		</script>
		
</head>
<body>
<div class=pageContent>

<jsp:include flush="true" page="../include/header.jsp"></jsp:include>

<div class=main>
	<form action="user.do?method=register" method="post" id="form1">
  <div class="tp7 tp7n">
  <script type="text/javascript">
									var agreement = false;
									function setAgreement(){
									agreement=!agreement;
									}
									
									function register(){
									
									
									var username=document.getElementById("username").value;
									var password=document.getElementById("password").value;
									var rpassword=document.getElementById("rpassword").value;
									var chooseBirthday = document.getElementById("chooseBirthday").value;
									var email = document.getElementById("email").value;
									
									if(username==""){
									alert("昵称不能为空");
									return false;
									}
									if(password==""){
									alert("密码不能为空");
									return false;				
									}
									if(password!=rpassword){
									alert("两次密码不一样");
									return false;
									}
									if(chooseBirthday==""){
									alert("生日不能为空");
									return false;
									}
									if(email.indexOf("@")==-1){
									alert("请填写真实油箱,邮箱将用于密码找回!");
									return false;
									}
									if(!agreement){
										alert("只有同意注册协议才能注册本站用户!");
										return false;
										}
									
									
									return true;
									}
									function show() {
										
										var o = document.getElementById("identify");
										
										o.src = "user.do?method=identify";
										
										
									}
									
									</script>
    <h3>用户注册</h3>
      <div id="zl">
        <div>
          <label>电子邮箱：</label>
          <input class="fmx"  type="text" id="email" name="email"/>
        </div>
        <div>
          <label>昵称：</label>
          <input class="fmx"  type="text" id="username" name="username"/>
        </div>
        <div>
          <label>密　码：</label>
          <input class="fmx"  type="password" name="password" id="password"/>
        </div>
        <div>
          <label>确认密码：</label>
          <input class="fmx"  type="rpassword" name="rpassword" id="password"/>
        </div>
        <div>
          <label>性　别：</label>
          <input type="radio" name="gender" value="1"/> 男 
		<input type="radio" name="gender" value="0" checked/> 女
		 </div>
        <div>
          <label>出生日期：</label>
          <input class="fmx" name="chooseBirthday" id="chooseBirthday"/>
        </div>
        <div>
          <label>所在地区：</label>
 			<select name="province" id="province" onchange="findCity();">
				<option>省/市</option>
			</select>-
			<select name="city" id="city" onchange="findRegion();">
				<option>市/地区</option>
			</select>-
			<select name="region" id="region">
				<option>县/市</option>
			</select>
        </div>
        
        <div>
          <label>验证码：</label>
          <input  type="text" name="identify"/><img id="identify" src="user.do?method=identify"/>
        <a href="javascript:show()" class="zl1">看不清，点击换一张</a>
        </div>　
        <input type="checkbox" name="agreement" value="agree" onclick="setAgreement();"/>我已阅读并同意注册协议<br/>
          <input type="submit" class="button01" onclick='if(!register()){return false}' value="填写完毕" />
      </div>
  </div>
  
  </form>
</div>


<jsp:include flush="true" page="../include/footer.jsp"></jsp:include>

</div>

<script>
		findPro();
		</script>
</body>
</html>
